<html>
    <head>
        <title>Sequence序列内置函数</title>
        <meta charset="UTF-8">
    </head>
    <body>
        <#--
            1.sequence?first 返回sequence的第一个值。
            2.sequence?last 返回sequence的最后一个值。
            3.sequence?reverse 将sequence的现有顺序反转，即倒序排序
            4.sequence?size 返回sequence的大小
            5.sequence?sort 将sequence中的对象转化为字符串后顺序排序
            6.sequence?sort_by(value) 按sequence中对象的属性value进行排序
        -->
        <#assign hobbies=["抽烟", "喝酒", "烫头"] />

        <p>hobbies?first: ${hobbies?first}</p>
        <p>hobbies?last: ${hobbies?last}</p>
        <p>hobbies?reverse: ${hobbies?reverse?first}</p>
        <p>hobbies?size: ${hobbies?size}</p>

        <!--从小到大排列-->
        <#assign array=[1, 32, 12, 2, 3, 22] >
        <p>array?sort: <#list array?sort as arr>${arr} </#list></p>

        <!--根据Book 的 author 字母进行排序-->
        <p>sequence?sort_by(value):
            <#list books?sort_by('author') as book>
                ${book.id} -- ${book.name} -- ${book.author}<br>
            </#list>
        <p>

    </body>
</html>
